package org.ccams.dao;

import java.util.List;

import org.ccams.domain.TDept;
import org.ccams.util.PageParameter;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class TDeptDAO extends SqlMapClientDaoSupport {


    public TDeptDAO() {
        super();
    }

  
    public int insert(TDept record) {
        return (Integer)getSqlMapClientTemplate().update("t_dept.abatorgenerated_insert", record);
    }

 
    public int updateByPrimaryKey(TDept record) {
        int rows = getSqlMapClientTemplate().update("t_dept.abatorgenerated_updateByPrimaryKey", record);
        return rows;
    }


    public int updateByPrimaryKeySelective(TDept record) {
        int rows = getSqlMapClientTemplate().update("t_dept.abatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

  
    public TDept selectByPrimaryKey(Long idtDept) {
        TDept key = new TDept();
        key.setIdtDept(idtDept);
        TDept record = (TDept) getSqlMapClientTemplate().queryForObject("t_dept.abatorgenerated_selectByPrimaryKey", key);
        return record;
    }

  
    public int deleteByPrimaryKey(Long idtDept) {
        TDept key = new TDept();
        key.setIdtDept(idtDept);
        int rows = getSqlMapClientTemplate().delete("t_dept.abatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }
    

    @SuppressWarnings("unchecked")
	public List<TDept> getByPage(PageParameter page){    	
    	return getSqlMapClientTemplate().queryForList("t_dept.getByPage", page);
    }
    /**
     * 返回记录总数
     * @return
     */
    public int getCount(){
    	return (Integer)getSqlMapClientTemplate().queryForObject("t_dept.getCount");
    }
    /**
	 * 返回所有
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public  List<TDept> getAll(){		
		return getSqlMapClientTemplate().queryForList("t_dept.getAll");
	}
}